package warmachineroster.grapheditor.editpart;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.ComponentEditPolicy;
import org.eclipse.gef.requests.GroupRequest;

import warmachineroster.Roster;
import warmachineroster.RosterElement;
import warmachineroster.grapheditor.command.RosterElementRemoveCommand;

public class SoloRosterElementEditPart extends RosterElementEditPart {

	@Override
	protected IFigure createFigure() {
		return super.createFigure();
	}

	@Override
	protected void createEditPolicies() {
		installEditPolicy(EditPolicy.COMPONENT_ROLE, new ComponentEditPolicy(){
			@Override
			protected Command createDeleteCommand(GroupRequest request){
				RosterElementRemoveCommand command = new RosterElementRemoveCommand();
				command.setRosterElement((RosterElement) getModel());
				command.setRoster((Roster) getParent().getModel());
				return command;
			}
			});
		
	}



}
